import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/layout-sider.vue'
import exampleRoutes from '@/example/index.ts'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/home',
    meta: { showMenu: false },
  },
  {
    path: '/home',
    redirect: '/home/index',
    component: Layout,
    meta: { title: 'home', icon: 'SettingOutlined' },
    children: [
      {
        path: 'index',

        component: () => import('@/views/HomeView.vue'),
        meta: { title: 'index', icon: 'SettingOutlined' },
      },
      {
        path: 'about',

        meta: { title: '关于2', icon: 'SettingOutlined' },
        children: [
          {
            path: 'about3',

            component: () => import('@/views/AboutView.vue'),
            meta: { title: '关于3', icon: 'SettingOutlined' },
          },
        ],
      },
      {
        path: 'abou',

        component: () => import('@/views/AboutView.vue'),
        meta: { title: '关于关于3关于3关于3关于33', icon: 'SettingOutlined' },
      },
    ],
  },
  // {
  //   path: '/home',

  //   component: () => import('../views/HomeView.vue'),
  // },
  {
    path: '/about',

    component: () => import('../views/AboutView.vue'),
    meta: { title: '关于', icon: 'SettingOutlined' },
  },
]

const defaultRoutes = [
  {
    path: '/login',
    component: () => import('@/views/AboutView.vue'),
    meta: { showMenu: false },
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401.vue'),
    meta: { showMenu: false },
  },
  {
    path: '/500',
    component: () => import('@/views/error-page/500.vue'),
    meta: { showMenu: false },
  },
  {
    path: '/:pathMatch(.*)',
    component: () => import('@/views/error-page/404.vue'),
    meta: { showMenu: false },
  },
]

const allRoutes = import.meta.env.DEV
  ? [...routes, ...defaultRoutes, ...exampleRoutes]
  : [...routes, ...defaultRoutes]

export default allRoutes
